# 开发者工具元素窗口看到的html结构内容  和代码请求的有可能不一致
# 开发者工具元素窗口 显示的js渲染（dom操作）之后的页面
# 代码请求的 是js渲染之前的页面

import requests
from lxml import etree

url = "https://www.xinpianchang.com/discover/article-1-394"
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
}
response = requests.get(url, headers=headers)
result = response.content.decode()
with open("index.html", "w", encoding="utf-8") as f:
    f.write(result)